package com.example.papercut.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 映射 URL 路径 /uploads/creations/** 到本地绝对文件路径
        // file:///D:/数据库/数据库系统/papercut/uploads/creations/
        registry.addResourceHandler("/uploads/creations/**")
                .addResourceLocations("file:./uploads/creations/");
                // 注意：file:./ 会被解析为 CWD 的绝对路径
    }
}